﻿@model PilotMVC.Models.QuizQuestionView
           
@{ 
    Layout = "~/Views/Shared/_ExaminerLayout.cshtml";
}
<link href="../../Content/items1/quizTable.css" rel="stylesheet" type="text/css" />

<div  style="width:900px;">   



    <div  style="width:800px;height:60px;margin:auto;background-color:#ebf4fb;border:2px solid #b7ddf2">

        <div style="width:700px;height:60px;float:left;margin-top:20px;margin-left:10px; ">
         <span style="float:left;"><p>Current question number <span style="color:Blue;">@Model.currentQuestionNumber &nbsp </p></span>
     
         <span style="float:right;"><p>Todays Date <span style="color:Blue;">@Model.Date</span> &nbsp&nbsp&nbsp Total number of questions  <span style="color:Blue;">@Model.numberOfQuestion </span></p></span>
       </div>

    </div>
    <div  style="width:800px;margin:auto;height:480px;margin-top:40px;background-color:#ebf4fb;border:2px solid #b7ddf2">

    
        @using (Html.BeginForm("SaveAnswer", "Quiz", FormMethod.Post))
        { 
            <div style="height:380px;">
         
            <div class="qu">
                   @Html.HiddenFor(model => model.TestQuestion.TestId)

               <p >@Html.DisplayFor(modelItem => modelItem.TestQuestion.Question.QuestionText)</p>
            </div>


           <div>
            <p >&nbsp</p>
           </div>
                
          
           
            
              @foreach (var item in @Model.Options.OrderByDescending(a=> !a.OptionText.Equals("All of the above")))
              {
                  
                  
                    if (Model.selectedPreviousAnswer == null)
                    {
                        <div class="opt">
                            <div style="width:15px;float:left;"><span class="radio">@Html.RadioButtonFor(a => a.SelectedAnswer.OptionId, item.Id )</span></div>
                            <div  style="width:575px;float:right;"><span class="text">@Html.Label(item.OptionText)</span></div>
                        </div>
                    }
                    else if(Model.selectedPreviousAnswer != null)
                    {
                        if (Model.selectedPreviousAnswer.OptionId == item.Id)
                        {
                           <div class="opt">
                               <div style="width:15px;float:left;"> <span class="radio">@Html.RadioButtonFor(a => a.SelectedAnswer.OptionId, item.Id, new { @checked = "checked" })</span></div>
                                <div  style="width:575px;float:right;"><span class="text"> @Html.Label(item.OptionText)</span></div>
                            </div>
                        }
                        else
                        {
                             <div class="opt">
                               <div style="width:15px;float:left;"> <span class="radio">@Html.RadioButtonFor(a => a.SelectedAnswer.OptionId, item.Id)</span></div>
                               <div  style="width:575px;float:right;"> <span class="text"> @Html.Label(item.OptionText)</span></div>
                            </div>
                        }

                    }

                }
        
             </div>

                <div id="footer" style="width:650px;height:20px;margin:auto;">
                <span style="float:right;">
              @if (Model.TestQuestion.QuestionOrder == Model.numberOfQuestion)
              {
                    <input id = "Submit" type="submit" name="submitAnswer" value="Submit" class="quizb"/>
              }
              else
              {
                    <input id = "Next" type="submit" name="submitAnswer" value="Next"  class="quizb"/>
              }
            </span>

            <span style="float:left;">
    

              @if (Model.TestQuestion.QuestionOrder != 1 && Model.TestQuestion.QuestionOrder != 0)
              {
                     <input id = "Previous" type="submit" name="submitAnswer" value="PreviousQuestion" class="quizb" />
              }
              
            </span>
         </div> 
         
        } 
    </div>
</div>